import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

    }

    //递归打印一个数的每一个数字
    public static void printNum(int n){
        if(n/10 == 0){
            System.out.println(n);
        }else {
            printNum(n/10);
            System.out.println(n%10);
        }
    }

    //递归求一个数的各个位相加之和
    public static int sum(int n){
        if(n/10 == 0){
            return n;
        }else {
            return n%10 + sum(n/10);
        }
    }

    //判断闰年
    public static void main1(String[] args) {
        for (int i = 0; i < 2000; i++) {
            if(i%4 == 0&&i%100 != 0){
                System.out.println(i + "年是闰年");
            } else if (i%400 == 0) {
                System.out.println(i + "年是闰年");
            }else {
                System.out.println(i + "年不是闰年");
            }
        }
    }

    //求二进制中1的个数
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要计算的数字：");
        int n = scanner.nextInt();
        int count = 0;
        while (n != 0){
            n = n & (n - 1);
            count++;
        }
        System.out.println("二进制形式中1的个数为" + count);
    }
}